clear all;
load('result.mat','rank_hist','f');

fig=figure('color', [1 1 1 ], 'Position',[200 200 800 320]);

plot([0.75,0.75],[0, 100],'--k','linewidth',1)
hold on
plot([3.33,3.33],[0, 100],'--k','linewidth',1)
hold on
plot([1.4,1.4],[0, 100],'--k','linewidth',1)

bar(rank_hist,f,1,'facecolor','blue');

annotation('arrow',[0.272  0.237],[0.85 0.85], 'LineStyle','--','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(1, 18, 'Ang Thong (25th percentile)','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');

annotation('arrow',[0.643  0.608],[0.85 0.85], 'LineStyle','--','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(3.6, 18, 'Sa Kaeo (75th percentile)','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');

annotation('arrow',[0.365  0.33],[0.7 0.7], 'LineStyle','--','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(1.67, 14.1, 'Sing Buri (median)','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');

xlabel('timing difference', 'FontSize',12,'Interpreter','Latex');
ylabel('number of provinces', 'FontSize',12,'Interpreter','Latex');
xlim([0,5.4])
ylim([0,20])
xticks(0.2:0.4:5.8);
set(gca,'FontSize',12);
